<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateO2oShopTagsTable extends Migration
{
	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		$prefix = config('ibrand.app.database.prefix', 'ibrand_');
		if (!Schema::hasTable($prefix . 'o2o_shop_tags')) {
			Schema::create($prefix . 'o2o_shop_tags', function (Blueprint $table) {
				$table->increments('id');
				$table->string('name')->unique()->comment('标签名');
				$table->string('url')->nullable()->comment('标签链接');
				$table->string('file')->nullable()->comment('标签图');
				$table->string('file_url')->nullable()->comment('标签图URL');
				$table->string('top')->default(false)->comment('3公里优先');
				$table->string('point_img')->default(false)->comment('是否使用标签图片做定位点图片');
				$table->integer('sort')->unsigned()->comment('序号');
				$table->string('code')->nullable()->comment('标签代码');
			});
		}
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		$prefix = config('ibrand.app.database.prefix', 'ibrand_');

		Schema::dropIfExists($prefix . 'o2o_shop_tags');
	}
}
